/*******************************************************************************
 *  Copyright (c) 2020-2201 Yichen Science and Tecthnology Co., Ltd.
 *
 *  File   :    socketlib.h
 *  Author :    luomin
 *  E_mail :    luomin5417@qq.com
 *  Date   :    2021/10/28
 *  Desc   :    
 *
 *  History:
 *  Date                      Modifier                    Content
******************************************************************************/
#ifndef __SOCKETLIB_H__
#define __SOCKETLIB_H__

#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/if.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
#include <unistd.h>

#ifndef NIPQUAD
#define NIPQUAD(addr) \
	((unsigned char *)&addr)[0], \
	((unsigned char *)&addr)[1], \
	((unsigned char *)&addr)[2], \
	((unsigned char *)&addr)[3]
#endif

int create_raw_socket(uint16_t proto);
int create_raw_socket_intf(uint16_t proto, int8_t *intf);
int create_broadcast_socket();
int create_multicast_socket(int port , char *grpaddr, char *ipaddr);
int create_multicast_socket_intf(int port , char *grpaddr, char *intf);

#endif